package com.pine.app.module.security.oauth.user.password;

import org.springframework.beans.factory.annotation.Autowired;

/**
 *  默认实现的密码校验类
 * @author xiaoyuan
 * @create 2020/3/12 13:02
 **/

public class DefaultPasswordVerifiers  extends AbstractPasswordVerifiers {
    private PasswordEncoder passwordEncoder;

    @Autowired
    public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
        this.passwordEncoder = passwordEncoder;
    }

    public DefaultPasswordVerifiers(){

    }

    public DefaultPasswordVerifiers(PasswordEncoder passwordEncoder){
        this.passwordEncoder = passwordEncoder;
    }


    @Override
    protected boolean validatePassword(String resource, String target) {
        return passwordEncoder.matches(target,resource);
    }
}
